import Vuex from 'vuex';
import Vue from 'vue';
import VuexPersist from 'vuex-persist'
import bookList from './bookList'
import categoryList from './categoryList'
Vue.use(Vuex);
export default new Vuex.Store({
    state: {
        username: '',
        bookList: bookList,
        categoryList: categoryList,
        book: {},
        cart: []
    },
    mutations: {
        LOGIN(state, {
            username
        }) {
            state.username = username;
        },
        DETAIL(state, book) {
            state.book = book;
        },
       
    },
    plugins: [
        new VuexPersist({
            storage: window.localStorage,
        }).plugin,
    ]
})